﻿// JScript File

function saveexcel(tdoc, fileName)
{
var ttt=tdoc.document.execCommand("SaveAs", "false", (fileName ? fileName : "Rapor") + ".xls");
     if(ttt==true);
}  

function sout(eButton)
{
    eButton.style.backgroundColor = "#F3F3F3";
    eButton.style.borderColor = "#FFFFFF";
    eButton.style.color = "#000000";
}


function backtowhite(eButton)
{
    eButton.style.backgroundColor = "#FFFFFF";
    eButton.style.borderColor = "#FFFFFF";
    eButton.style.color = "#000000";
}

 
function sover(eButton)
{
    eButton.style.backgroundColor = "#D1E0EF";
    eButton.style.borderColor = "#CC3300";
    eButton.style.color = "#000000";
    eButton.style.cursor="hand";
}


function sSelect(eButton)
{
    eButton.style.backgroundColor = "#CC3300";
    eButton.style.borderColor = "#FFFFFF";
    eButton.style.color = "#FFFFFF";
    eButton.style.cursor="hand";
}

function show(eButton)
{
    eButton.style.backgroundColor = "#D1E0EF";
    eButton.style.borderColor = "#FFFFFF";
    eButton.style.color = "#000000";
    eButton.style.cursor="hand";
}

function yenile()
{
    history.go(0);
}


function kapaveyenile()
{
    opener.yenile();
    window.close();
}

function tkapaveyenile()
{
    opener.parent.fr_top.yenile();
    opener.parent.fr_left.yenile();
    opener.parent.fr_right.yenile();
    window.close();
}

function t2kapaveyenile()
{
    opener.parent.fr_top.yenile();
    opener.parent.fr_left.yenile();
    window.close();
}

function yeniyukle()
{
    window.location.reload();
}

function kapaveyenile()
{
    opener.yenile();
    window.close();
}


function kapaveyeniyukle()
{
    opener.yeniyukle();
    window.close();
}



function kapat(){
window.close();
}

function tkapat(){
top.window.close();
}

function pkapat(){
parent.close();
}

function gerigit()
{
history.go(-1);
}

function maxi(){
window.maximize();
}

function refpen(adr,en,boy,scrl,myid){
//document.cookie="refid="+myid;
session.refid=+myid;
var en,boy;
DETAY=window.open(adr,"DETAY","resizable=1,width="+en+",height="+boy+",toolbar=no menubar=no,status=no,scrollbars="+scrl);
//DETAY.focus();
}



var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable,toolbar=no menubar=no,status=no'
win = window.open(mypage,myname,settings)
}

var win = null;
function pencere(mypage,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,toolbar=no menubar=no,status=no'
win = window.open(mypage,'detay',settings)
}


var win = null;
function ypencere(mypage,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,toolbar=no menubar=no,status=no'
win = window.open(mypage,'ydetay',settings)
}

var win = null;
function y2pencere(mypage,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,toolbar=no menubar=no,status=no'
win = window.open(mypage,'y2detay',settings)
}

var win = null;
function y3pencere(mypage,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,toolbar=no menubar=no,status=no'
win = window.open(mypage,'y3detay',settings)
}



function ClipBoard() 
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}


function test() {
alert('ok')
} 

function notEmpty (s) {
if (s != '')
return true;
alert ('Alan bo&#351; b&#305;rak&#305;lamaz!');
 return false;
}

function inRange (s,l,u) {
if (s >= l && s<=u)
return true;
alert ('Alan&#305;n de&#287;eri ' +l+ ' ile ' +u+ ' aras&#305;nda olmal&#305;d&#305;r!');
return false;
}

function hasLen (s,l,u) {
if (s.length >= l && s.length<=u)
return true;
alert ('Alan&#305;n uzunlu&#287;u ' +l+ ' ile ' +u+ ' aras&#305;nda olabilir!');
return false;
}

function isNumeric (s) {
var i;
for (i=0;i<s.length;i++) {
if ((s.charCodeAt(i)<48 || s.charCodeAt(i)>57) && s.charCodeAt(i)!=46) {
alert('Alana sadece nümerik karakterler yaz&#305;labilir!')
return false;
};
};
return true;
}

function validation (obj, ctrls, chars) {
if (obj) {
for (c=0;c<ctrls.length;c++) {
if (!eval(ctrls[c].replace(/#/gi,"'" + obj.value + "'"))) {
obj.focus ();
return false;
};
};
}
return true;
}
function validate_form (frm) {
if (frm) {
for (e=0;e<frm.elements.length;e++){
if (eval('typeof (frm.validate_' + frm.elements[e].name + ')') == 'object') {
if (!eval(eval('frm.validate_' + frm.elements[e].name + '.value'))){
return false;
};
};
};
};
return true;
}


 function fncBreakOutOfFrames() {
   if (top.document.location.href != document.location.href) {
     top.document.location.href = document.location.href;
	 //parent.window.location.href  = document.location.href;
   }
 }


function Pay_onkeypress() 	{
	if (window.event.keyCode < 48 || window.event.keyCode > 57)		return false;
}

function Amount_onkeypress() {
	if (window.event.keyCode<48 || window.event.keyCode>57){
	return false;}
}

function Allowed_Inputs(e,truechars){
	var whichCode = (window.Event) ? e.which : e.keyCode;
	//alert(whichCode);
	for (i=0; i<truechars.length; i++)
	{
		if (whichCode==truechars.charCodeAt(i)) {
			return true;
		}
	}
	return false;

}


function Amount_onkeyup(thisis) {
	//alert(thisis.value);
	var tempstr,newstr,str,i,str2 ;
	var commapos,aftercomma,commacount;
	i=0;
	str = thisis.value;
	if (str.indexOf(",")<0){// çal&#305;&#351;ma
	//alert(str);
	//str = str.replace(".","");
	//alert(str);

	while ( 15 > i) {
		str = str.replace(".","");
		i=i+1;
		}
	commacount=0;
	commapos=str.indexOf(";");

	if (commapos>=0)
	{
		aftercomma=str.substr(commapos);
		str=str.substr(0,commapos);
	}
	else
		aftercomma="";

	if (str.length > 3)
	{
		tempstr=str;
		newstr="";
		while (tempstr.length>3)
		{
			newstr="."+tempstr.substr(tempstr.length-3)+newstr;
			tempstr=tempstr.substr(0,tempstr.length-3);
		}
		thisis.value = tempstr+newstr+aftercomma;
	}
	}//indexOf
	return true;
}


function Name_onkeypress() {
	if (window.event.keyCode<65 && window.event.keyCode!=32){
	return false;}
}

function Comma(number) {
	number = '' + number;
	if (number.length > 3) {
		var mod = number.length % 3;
		var output = (mod > 0 ? (number.substring(0,mod)) : '');
		for (i=0 ; i < Math.floor(number.length / 3); i++) {
			if ((mod == 0) && (i == 0))
				output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
			else
				output+= '.' + number.substring(mod + 3 * i, mod + 3 * i + 3);
		}
		return (output);
	}
	else return number;
}

function Numeric_Control(e) {
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  // Enter

	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48){
	return false;}
}

function Only_Numeric(e) {
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Comma
	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}

function Only_Character(e) {
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Enter
	if (whichCode > 47 && whichCode < 58){
	return false;}
}



function Only_Digit(e) {
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  // Enter
	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}



function Only_Letter(e) {

	var whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  // Enter
	if (whichCode == 0) return true;  //Delete etc.

	if ((whichCode >=97 && whichCode <=122) || (whichCode <=90 && whichCode >=65)){
	return true;}

	var validChars="üÜ&#287;&#286;&#305;&#351;&#350;&#304;çÇöÖ ";

	for (i=0; i<validChars.length; i++)
	{
		if (whichCode==validChars.charCodeAt(i)) {
			return true;
		}
	}

	return false;
}


function fullwin(targeturl){
window.open(targeturl,"","fullscreen,scrollbars=0")
}



function oppage(pgprm, fid){top.location=pgprm+"?fid="+fid+"&brw=B"}

function mmon (obj) { obj.style.cursor="hand"; obj.style.color="#ffff66" }
function mmof (obj) { obj.style.cursor="default"; obj.style.color="" }

function frmpage (runfile, pfile, menucode, fileid, brwtip) {
  eval("top.location='"+runfile+"?fnm="+pfile+"&mln="+menucode+"&fid="+fileid+"&brw="+brwtip+"'");
}

function hbrpage (prm) { eval("top.location='/haberler/haberfrm.asp?fnm="+prm+"&mln=55&brw=B'"); }








function gopgt(pg1) { self.location = pg1; }
function ifgopgt(pg1) { self.location = pg1; }

function mon (obj) { obj.style.cursor="hand"; obj.style.color="#C20000" }
function mof (obj) { obj.style.cursor="default"; obj.style.color="" }

function mo(obj) { obj.style.backgroundColor="#DDDDDD"; obj.style.cursor="hand" }
function mc(obj) { obj.style.backgroundColor=""; obj.style.cursor="default" }


function opwin(trg){
  ow=window.open(trg, "fnews","resizable=yes, width=700, height=450, top=95, left=40, menubar=no, scrollbars=yes");
  ow.focus();
}



function solpage (prm, xx) { eval("top.location='/cozumler/cozumler.asp?fnm="+prm+"&mln="+xx+"'"); }


function ktppage (prm, xx) { eval("top.location='/destek/kutuphane.asp?fnm="+prm+"&mln="+xx+"'"); }

function engfrmpage (prm, xx) { eval("top.location='/eng/plantumweb/plantumweb.asp?fnm="+prm+"&mln="+xx+"'"); }
function engsolpage (prm, xx) { eval("top.location='/eng/solution/solution.asp?fnm="+prm+"&mln="+xx+"'"); }
function enghbrpage (prm) { eval("top.location='/eng/news/newsfrm.asp?fnm="+prm+"'"); }

// only numbers
function Onm(e) {
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Comma
        if (whichCode == 46) return true;  // Nokta
        if (whichCode > 57 ){ return false;}
        if (whichCode < 48 && whichCode > 13){ return false;}
}

// only numbers
function Onmxx(e) {
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;  // Enter
        if (whichCode > 57 ){ return false;}
        if (whichCode < 48 && whichCode > 13){ return false;}
}

function g(id)
{
    return document.getElementById(id);
}
function clearDropDown(id)
{
    g(id).options.length = 0;
}

function hideControl(id)
{
    g(id).style.visibility = "hidden";
}

function showControl(id)
{
    g(id).style.visibility = "visible";
}

function addOption(id, val, txt, isSel)
{
    var opt = document.createElement("option");
    opt.value = val;
    opt.innerHTML = txt;
    if(isSel == 1) opt.selected = true;
    g(id).appendChild(opt);
}

function setEnableState(id, enableState)
{
    if(enableState == true)
    {
        g(id).disabled = false;
    }
    else
    {
        g(id).disabled = true;
    }
}